 <?php 

 class admin extends CI_Controller {

 	public function index(){

 		$this->load->view('header');
 		$this->load->view('adminLogin');
 		$this->load->view('footer');
 	}

 	public function login()
 	{
 		if($this->input->post("username")=="admin" && $this->input->post("password")=="lorumipsum125") 
 		{
        	//session user data
            $newdata = array(
                   'admin'  => true,
                   'loged_in_admin' => true
               ); 

            $this->session->set_userdata($newdata);
            redirect('admin/approve_ads/');
 		}
 		else {
 			redirect(base_url()."admin?inc=Incorect username/password");
 		}
 	}

 	public function approve_ads()
 	{
 		if($this->session->userdata('admin'))
 		{
 			$nav["tab"] = "ad";
 			$this->db->where('active',2);
 			$data["records"] = $this->db->get("ads")->result();

	 		$this->load->view('header');
	 		$this->load->view('admin_nav',$nav);
	 		$this->load->view('approve_ads_content',$data);
	 		$this->load->view('footer');
 		}
 		else
 		redirect(base_url()."admin?inc=Incorect username/password");
 	}

 	public function approve_notes(){

 		if($this->session->userdata('admin'))
 		{
 			$data["tab"] = "note";

	 		$this->load->view('header');
	 		$this->load->view('admin_nav',$data);
	 		$this->load->view('approve_notes_content',$data);
	 		$this->load->view('footer');
 		}
 		else
 		redirect(base_url()."admin?inc=Incorect username/password");

 	}

 	public function log_out(){
 		$this->session->set_userdata('admin',false);
 		$this->session->sess_destroy();
 		redirect(base_url()."admin/");
 	}

 	public function approve_ad(){
 		

 	}

 	public function delete_ad() {

 	}

 	public function approve_note(){

 	}

 	public function delete_note(){

 	}



 }